#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long a[200005], b[200005] = {0};
	long long sum = 0;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
	}
	for (int i = 1;i <= n;i++)
	{
		b[i] = b[i - 1] + a[i];
	}
	for (int i = 1;i <= n;i++)
	{
		sum += a[i] * (b[n] - b[i]);
	}
	cout << sum;
	return 0;
}
